package com.cqggrw.action;

import com.cqggrw.domain.Json;
import com.cqggrw.domain.Role;
import com.cqggrw.service.RoleServiceI;
import com.cqggrw.service.impl.RoleServiceImpl;
import com.opensymphony.xwork2.ModelDriven;

public class RoleAction extends BaseAction implements ModelDriven<Role>{

	private static final long serialVersionUID = 1L;
	private RoleServiceI<Role> service = new RoleServiceImpl();
	private Role role = new Role();
	
	public void add() {
		Json json = new Json();
		if (service.add(role)) {
			json.setSuccess(true);
			json.setMsg("添加成功!");
		} else {
			json.setSuccess(false);
			json.setMsg("添加失败!");
		}
		
		super.writeJson(json);
	}

	public Role getModel() {
		return role;
	}

}
